home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games 1996 December / Amiga Games 1996 #12.iso / rexx / ttx / getxref.ttx < prev   
Text File  |  1992-12-29  |  2KB  |  107 lines

  1. /** $VER: GetXRef.ttx 2.0 (30.Oct.91)
  2.  ** Written by David N. Junod
  3.  **
  4.  ** Display the hypertext Autodoc page for the word currently under the
  5.  ** cursor.
  6.  **
  7.  ** Add the following line to your TTX_Startup.dfn file, in the KEYBOARD:
  8.  ** section.
  9.  **
  10.  **   HELP        ExecARexxMacro REXX:GetXRef.ttx SYNC
  11.  **   SHIFT-HELP  ExecARexxMacro REXX:GetXRef.ttx ASYNC
  12.  **
  13.  ** Add the following lines to your S:user-startup file.
  14.  **
  15.  **   RX "AddLib('amigaguide.library',0,-30)"
  16.  **   RX "LoadXRef('autodocs.xref')"
  17.  **
  18.  **/
  19.  
  20. OPTIONS RESULTS
  21. PARSE ARG mode word
  22.  
  23. IF ~SHOW('L','amigaguide.library') THEN
  24.    CALL ADDLIB('amigaguide.library',0,-30)
  25.  
  26. /* Did they pass a word? */
  27. IF word = "" THEN DO
  28.  
  29.   GetWord
  30.   word = RESULT
  31.  
  32.   END
  33.  
  34. RequestStr PROMPT "Function:" word
  35. word = RESULT
  36.  
  37. /* See if the Autodoc cross-reference table is loaded */
  38. line = GetXRef("OpenWindow()")
  39. IF line = 10 THEN DO
  40.  
  41.    /* Show that we're doing something */
  42.    message = 'Loading cross-reference file...'
  43.    SetStatusBar Temporary message
  44.  
  45.    /* The Autodoc table wasn't loaded, so load it. */
  46.    LoadXRef(autodocs.xref)
  47.    END
  48.  
  49. /* See if the word is in the cross-reference table */
  50. function = word
  51. xref = 0
  52. line = GetXRef(function)
  53. IF line = 10 THEN DO
  54.   /* Add the parens to the name */
  55.   function = word||"()"
  56.  
  57.   /* Try again */
  58.   line = GetXRef(function)
  59.   IF line = 10 THEN DO
  60.      function = word
  61.      END
  62.   ELSE DO
  63.      xref = 1
  64.      END
  65.   END
  66. ELSE DO
  67.   xref = 1
  68.   END
  69.  
  70. /* Show that we're doing something */
  71. message = 'Loading '||function||'...'
  72. SetStatusBar Temporary message
  73.  
  74. /* See if we have an Autodoc viewing window open */
  75. IF ~SHOW('P','AUTODOCS') THEN DO
  76.  
  77.   /* See if we are trying to load a database or a document */
  78.   IF xref = 0 THEN
  79.      cmd = "run AmigaGuide "||function||" portname AUTODOCS pubscreen TURBOTEXT requester"
  80.   ELSE
  81.      cmd = "run AmigaGuide document "||function||" portname AUTODOCS pubscreen TURBOTEXT requester"
  82.  
  83.   ADDRESS COMMAND cmd
  84.  
  85.   END
  86.  
  87. ELSE DO
  88.  
  89.   /* What command do we use to show the node */
  90.   link = "Link"
  91.   IF mode = "ASYNC" THEN
  92.      link = "ALink"
  93.  
  94.   /* See if we are trying to load a database or a document */
  95.   IF xref = 0 THEN
  96.      cmd = link||" "||function||"/main"
  97.   ELSE
  98.      cmd = link||" "||function
  99.  
  100.   /* Align the window */
  101.   ADDRESS AUTODOCS cmd
  102.  
  103.   /* I want it to come to the front, because I have limited space */
  104.   ADDRESS AUTODOCS "windowtofront"
  105.  
  106.   END
  107.